/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    cn-qingdao = 'dts.aliyuncs.com',
    cn-beijing = 'dts.aliyuncs.com',
    cn-zhangjiakou = 'dts.aliyuncs.com',
    cn-huhehaote = 'dts.aliyuncs.com',
    cn-hangzhou = 'dts.aliyuncs.com',
    cn-shanghai = 'dts.aliyuncs.com',
    cn-shenzhen = 'dts.aliyuncs.com',
    cn-hongkong = 'dts.aliyuncs.com',
    ap-southeast-1 = 'dts.aliyuncs.com',
    ap-southeast-2 = 'dts.aliyuncs.com',
    ap-southeast-3 = 'dts.aliyuncs.com',
    ap-southeast-5 = 'dts.aliyuncs.com',
    eu-west-1 = 'dts.aliyuncs.com',
    us-west-1 = 'dts.aliyuncs.com',
    us-east-1 = 'dts.aliyuncs.com',
    eu-central-1 = 'dts.aliyuncs.com',
    me-east-1 = 'dts.aliyuncs.com',
    ap-south-1 = 'dts.aliyuncs.com',
    cn-hangzhou-finance = 'dts.aliyuncs.com',
    cn-shanghai-finance-1 = 'dts.aliyuncs.com',
    cn-shenzhen-finance-1 = 'dts.aliyuncs.com',
    cn-north-2-gov-1 = 'dts.aliyuncs.com',
    ap-northeast-2-pop = 'dts.aliyuncs.com',
    cn-beijing-finance-1 = 'dts.aliyuncs.com',
    cn-beijing-finance-pop = 'dts.aliyuncs.com',
    cn-beijing-gov-1 = 'dts.aliyuncs.com',
    cn-beijing-nu16-b01 = 'dts.aliyuncs.com',
    cn-chengdu = 'dts.aliyuncs.com',
    cn-edge-1 = 'dts.aliyuncs.com',
    cn-fujian = 'dts.aliyuncs.com',
    cn-haidian-cm12-c01 = 'dts.aliyuncs.com',
    cn-hangzhou-bj-b01 = 'dts.aliyuncs.com',
    cn-hangzhou-internal-prod-1 = 'dts.aliyuncs.com',
    cn-hangzhou-internal-test-1 = 'dts.aliyuncs.com',
    cn-hangzhou-internal-test-2 = 'dts.aliyuncs.com',
    cn-hangzhou-internal-test-3 = 'dts.aliyuncs.com',
    cn-hangzhou-test-306 = 'dts.aliyuncs.com',
    cn-hongkong-finance-pop = 'dts.aliyuncs.com',
    cn-huhehaote-nebula-1 = 'dts.aliyuncs.com',
    cn-qingdao-nebula = 'dts.aliyuncs.com',
    cn-shanghai-et15-b01 = 'dts.aliyuncs.com',
    cn-shanghai-et2-b01 = 'dts.aliyuncs.com',
    cn-shanghai-inner = 'dts.aliyuncs.com',
    cn-shanghai-internal-test-1 = 'dts.aliyuncs.com',
    cn-shenzhen-inner = 'dts.aliyuncs.com',
    cn-shenzhen-st4-d01 = 'dts.aliyuncs.com',
    cn-shenzhen-su18-b01 = 'dts.aliyuncs.com',
    cn-wuhan = 'dts.aliyuncs.com',
    cn-wulanchabu = 'dts.aliyuncs.com',
    cn-yushanfang = 'dts.aliyuncs.com',
    cn-zhangbei-na61-b01 = 'dts.aliyuncs.com',
    cn-zhangjiakou-na62-a01 = 'dts.aliyuncs.com',
    cn-zhengzhou-nebula-1 = 'dts.aliyuncs.com',
    eu-west-1-oxs = 'dts.aliyuncs.com',
    rus-west-1-pop = 'dts.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('dts', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ConfigureSynchronizationJobRequest {
  destinationEndpoint?: {
    IP?: string(name='IP'),
    instanceId?: string(name='InstanceId'),
    instanceType?: string(name='InstanceType'),
    password?: string(name='Password'),
    port?: string(name='Port'),
    userName?: string(name='UserName'),
  }(name='DestinationEndpoint'),
  partitionKey?: {
    modifyTimeDay?: boolean(name='ModifyTime_Day'),
    modifyTimeHour?: boolean(name='ModifyTime_Hour'),
    modifyTimeMinute?: boolean(name='ModifyTime_Minute'),
    modifyTimeMonth?: boolean(name='ModifyTime_Month'),
    modifyTimeYear?: boolean(name='ModifyTime_Year'),
  }(name='PartitionKey'),
  sourceEndpoint?: {
    IP?: string(name='IP'),
    instanceId?: string(name='InstanceId'),
    instanceType?: string(name='InstanceType'),
    ownerID?: string(name='OwnerID'),
    password?: string(name='Password'),
    port?: string(name='Port'),
    role?: string(name='Role'),
    userName?: string(name='UserName'),
  }(name='SourceEndpoint'),
  checkpoint?: string(name='Checkpoint'),
  dataInitialization?: boolean(name='DataInitialization'),
  migrationReserved?: string(name='MigrationReserved'),
  ownerId?: string(name='OwnerId'),
  structureInitialization?: boolean(name='StructureInitialization'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
  synchronizationJobName?: string(name='SynchronizationJobName'),
  synchronizationObjects?: string(name='SynchronizationObjects'),
}

model ConfigureSynchronizationJobResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ConfigureSynchronizationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ConfigureSynchronizationJobResponseBody(name='body'),
}

async function configureSynchronizationJobWithOptions(request: ConfigureSynchronizationJobRequest, runtime: Util.RuntimeOptions): ConfigureSynchronizationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.checkpoint)) {
    query['Checkpoint'] = request.checkpoint;
  }
  if (!Util.isUnset(request.dataInitialization)) {
    query['DataInitialization'] = request.dataInitialization;
  }
  if (!Util.isUnset(request.migrationReserved)) {
    query['MigrationReserved'] = request.migrationReserved;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.structureInitialization)) {
    query['StructureInitialization'] = request.structureInitialization;
  }
  if (!Util.isUnset(request.synchronizationDirection)) {
    query['SynchronizationDirection'] = request.synchronizationDirection;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  if (!Util.isUnset(request.synchronizationJobName)) {
    query['SynchronizationJobName'] = request.synchronizationJobName;
  }
  if (!Util.isUnset(request.synchronizationObjects)) {
    query['SynchronizationObjects'] = request.synchronizationObjects;
  }
  if (!Util.isUnset(request.destinationEndpoint)) {
    query['DestinationEndpoint'] = request.destinationEndpoint;
  }
  if (!Util.isUnset(request.partitionKey)) {
    query['PartitionKey'] = request.partitionKey;
  }
  if (!Util.isUnset(request.sourceEndpoint)) {
    query['SourceEndpoint'] = request.sourceEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ConfigureSynchronizationJob',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function configureSynchronizationJob(request: ConfigureSynchronizationJobRequest): ConfigureSynchronizationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return configureSynchronizationJobWithOptions(request, runtime);
}

model ConfigureSynchronizationJobAlertRequest {
  delayAlertPhone?: string(name='DelayAlertPhone'),
  delayAlertStatus?: string(name='DelayAlertStatus'),
  delayOverSeconds?: string(name='DelayOverSeconds'),
  errorAlertPhone?: string(name='ErrorAlertPhone'),
  errorAlertStatus?: string(name='ErrorAlertStatus'),
  ownerId?: string(name='OwnerId'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
}

model ConfigureSynchronizationJobAlertResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ConfigureSynchronizationJobAlertResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ConfigureSynchronizationJobAlertResponseBody(name='body'),
}

async function configureSynchronizationJobAlertWithOptions(request: ConfigureSynchronizationJobAlertRequest, runtime: Util.RuntimeOptions): ConfigureSynchronizationJobAlertResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.delayAlertPhone)) {
    query['DelayAlertPhone'] = request.delayAlertPhone;
  }
  if (!Util.isUnset(request.delayAlertStatus)) {
    query['DelayAlertStatus'] = request.delayAlertStatus;
  }
  if (!Util.isUnset(request.delayOverSeconds)) {
    query['DelayOverSeconds'] = request.delayOverSeconds;
  }
  if (!Util.isUnset(request.errorAlertPhone)) {
    query['ErrorAlertPhone'] = request.errorAlertPhone;
  }
  if (!Util.isUnset(request.errorAlertStatus)) {
    query['ErrorAlertStatus'] = request.errorAlertStatus;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.synchronizationDirection)) {
    query['SynchronizationDirection'] = request.synchronizationDirection;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ConfigureSynchronizationJobAlert',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function configureSynchronizationJobAlert(request: ConfigureSynchronizationJobAlertRequest): ConfigureSynchronizationJobAlertResponse {
  var runtime = new Util.RuntimeOptions{};
  return configureSynchronizationJobAlertWithOptions(request, runtime);
}

model CreateSynchronizationJobRequest {
  destinationEndpoint?: {
    instanceType?: string(name='InstanceType'),
  }(name='DestinationEndpoint'),
  sourceEndpoint?: {
    instanceType?: string(name='InstanceType'),
  }(name='SourceEndpoint'),
  clientToken?: string(name='ClientToken'),
  destRegion?: string(name='DestRegion'),
  ownerId?: string(name='OwnerId'),
  payType?: string(name='PayType'),
  period?: string(name='Period'),
  sourceRegion?: string(name='SourceRegion'),
  synchronizationJobClass?: string(name='SynchronizationJobClass'),
  topology?: string(name='Topology'),
  usedTime?: int32(name='UsedTime'),
  networkType?: string(name='networkType'),
}

model CreateSynchronizationJobResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
}

model CreateSynchronizationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSynchronizationJobResponseBody(name='body'),
}

async function createSynchronizationJobWithOptions(request: CreateSynchronizationJobRequest, runtime: Util.RuntimeOptions): CreateSynchronizationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.destRegion)) {
    query['DestRegion'] = request.destRegion;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.payType)) {
    query['PayType'] = request.payType;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.sourceRegion)) {
    query['SourceRegion'] = request.sourceRegion;
  }
  if (!Util.isUnset(request.synchronizationJobClass)) {
    query['SynchronizationJobClass'] = request.synchronizationJobClass;
  }
  if (!Util.isUnset(request.topology)) {
    query['Topology'] = request.topology;
  }
  if (!Util.isUnset(request.usedTime)) {
    query['UsedTime'] = request.usedTime;
  }
  if (!Util.isUnset(request.networkType)) {
    query['networkType'] = request.networkType;
  }
  if (!Util.isUnset(request.destinationEndpoint)) {
    query['DestinationEndpoint'] = request.destinationEndpoint;
  }
  if (!Util.isUnset(request.sourceEndpoint)) {
    query['SourceEndpoint'] = request.sourceEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSynchronizationJob',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSynchronizationJob(request: CreateSynchronizationJobRequest): CreateSynchronizationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSynchronizationJobWithOptions(request, runtime);
}

model DeleteSynchronizationJobRequest {
  ownerId?: string(name='OwnerId'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
}

model DeleteSynchronizationJobResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model DeleteSynchronizationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteSynchronizationJobResponseBody(name='body'),
}

async function deleteSynchronizationJobWithOptions(request: DeleteSynchronizationJobRequest, runtime: Util.RuntimeOptions): DeleteSynchronizationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSynchronizationJob',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteSynchronizationJob(request: DeleteSynchronizationJobRequest): DeleteSynchronizationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSynchronizationJobWithOptions(request, runtime);
}

model DescribeEndpointSwitchStatusRequest {
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  taskId?: string(name='TaskId'),
}

model DescribeEndpointSwitchStatusResponseBody = {
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId'),
  status?: string(name='Status'),
}

model DescribeEndpointSwitchStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeEndpointSwitchStatusResponseBody(name='body'),
}

async function describeEndpointSwitchStatusWithOptions(request: DescribeEndpointSwitchStatusRequest, runtime: Util.RuntimeOptions): DescribeEndpointSwitchStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeEndpointSwitchStatus',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeEndpointSwitchStatus(request: DescribeEndpointSwitchStatusRequest): DescribeEndpointSwitchStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeEndpointSwitchStatusWithOptions(request, runtime);
}

model DescribeSynchronizationJobAlertRequest {
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
}

model DescribeSynchronizationJobAlertResponseBody = {
  delayAlertPhone?: string(name='DelayAlertPhone'),
  delayAlertStatus?: string(name='DelayAlertStatus'),
  delayOverSeconds?: string(name='DelayOverSeconds'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  errorAlertPhone?: string(name='ErrorAlertPhone'),
  errorAlertStatus?: string(name='ErrorAlertStatus'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
  synchronizationJobName?: string(name='SynchronizationJobName'),
}

model DescribeSynchronizationJobAlertResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSynchronizationJobAlertResponseBody(name='body'),
}

async function describeSynchronizationJobAlertWithOptions(request: DescribeSynchronizationJobAlertRequest, runtime: Util.RuntimeOptions): DescribeSynchronizationJobAlertResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.synchronizationDirection)) {
    query['SynchronizationDirection'] = request.synchronizationDirection;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSynchronizationJobAlert',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSynchronizationJobAlert(request: DescribeSynchronizationJobAlertRequest): DescribeSynchronizationJobAlertResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSynchronizationJobAlertWithOptions(request, runtime);
}

model DescribeSynchronizationJobStatusRequest {
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
}

model DescribeSynchronizationJobStatusResponseBody = {
  checkpoint?: string(name='Checkpoint'),
  dataInitialization?: string(name='DataInitialization'),
  dataInitializationStatus?: {
    errorMessage?: string(name='ErrorMessage'),
    percent?: string(name='Percent'),
    progress?: string(name='Progress'),
    status?: string(name='Status'),
  }(name='DataInitializationStatus'),
  dataSynchronizationStatus?: {
    checkpoint?: string(name='Checkpoint'),
    delay?: string(name='Delay'),
    errorMessage?: string(name='ErrorMessage'),
    percent?: string(name='Percent'),
    status?: string(name='Status'),
  }(name='DataSynchronizationStatus'),
  delay?: string(name='Delay'),
  destinationEndpoint?: {
    engineName?: string(name='EngineName'),
    IP?: string(name='IP'),
    instanceId?: string(name='InstanceId'),
    instanceType?: string(name='InstanceType'),
    port?: string(name='Port'),
    userName?: string(name='UserName'),
  }(name='DestinationEndpoint'),
  errorMessage?: string(name='ErrorMessage'),
  expireTime?: string(name='ExpireTime'),
  payType?: string(name='PayType'),
  performance?: {
    FLOW?: string(name='FLOW'),
    RPS?: string(name='RPS'),
  }(name='Performance'),
  precheckStatus?: {
    detail?: [ 
      {
        checkStatus?: string(name='CheckStatus'),
        errorMessage?: string(name='ErrorMessage'),
        itemName?: string(name='ItemName'),
        repairMethod?: string(name='RepairMethod'),
      }
    ](name='Detail'),
    percent?: string(name='Percent'),
    status?: string(name='Status'),
  }(name='PrecheckStatus'),
  requestId?: string(name='RequestId'),
  sourceEndpoint?: {
    engineName?: string(name='EngineName'),
    IP?: string(name='IP'),
    instanceId?: string(name='InstanceId'),
    instanceType?: string(name='InstanceType'),
    port?: string(name='Port'),
    userName?: string(name='UserName'),
  }(name='SourceEndpoint'),
  status?: string(name='Status'),
  structureInitialization?: string(name='StructureInitialization'),
  structureInitializationStatus?: {
    errorMessage?: string(name='ErrorMessage'),
    percent?: string(name='Percent'),
    progress?: string(name='Progress'),
    status?: string(name='Status'),
  }(name='StructureInitializationStatus'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobClass?: string(name='SynchronizationJobClass'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
  synchronizationJobName?: string(name='SynchronizationJobName'),
  synchronizationObjects?: [ 
    {
      newSchemaName?: string(name='NewSchemaName'),
      schemaName?: string(name='SchemaName'),
      tableExcludes?: [ 
        {
          tableName?: string(name='TableName'),
        }
      ](name='TableExcludes'),
      tableIncludes?: [ 
        {
          tableName?: string(name='TableName'),
        }
      ](name='TableIncludes'),
    }
  ](name='SynchronizationObjects'),
}

model DescribeSynchronizationJobStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSynchronizationJobStatusResponseBody(name='body'),
}

async function describeSynchronizationJobStatusWithOptions(request: DescribeSynchronizationJobStatusRequest, runtime: Util.RuntimeOptions): DescribeSynchronizationJobStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.synchronizationDirection)) {
    query['SynchronizationDirection'] = request.synchronizationDirection;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSynchronizationJobStatus',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSynchronizationJobStatus(request: DescribeSynchronizationJobStatusRequest): DescribeSynchronizationJobStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSynchronizationJobStatusWithOptions(request, runtime);
}

model DescribeSynchronizationJobsRequest {
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  synchronizationJobName?: string(name='SynchronizationJobName'),
}

model DescribeSynchronizationJobsResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageRecordCount?: int32(name='PageRecordCount'),
  requestId?: string(name='RequestId'),
  synchronizationInstances?: [ 
    {
      dataInitialization?: string(name='DataInitialization'),
      dataInitializationStatus?: {
        errorMessage?: string(name='ErrorMessage'),
        percent?: string(name='Percent'),
        progress?: string(name='Progress'),
        status?: string(name='Status'),
      }(name='DataInitializationStatus'),
      dataSynchronizationStatus?: {
        delay?: string(name='Delay'),
        errorMessage?: string(name='ErrorMessage'),
        percent?: string(name='Percent'),
        status?: string(name='Status'),
      }(name='DataSynchronizationStatus'),
      delay?: string(name='Delay'),
      destinationEndpoint?: {
        engineName?: string(name='EngineName'),
        IP?: string(name='IP'),
        instanceId?: string(name='InstanceId'),
        instanceType?: string(name='InstanceType'),
        port?: string(name='Port'),
        userName?: string(name='UserName'),
      }(name='DestinationEndpoint'),
      errorMessage?: string(name='ErrorMessage'),
      expireTime?: string(name='ExpireTime'),
      payType?: string(name='PayType'),
      performance?: {
        FLOW?: string(name='FLOW'),
        RPS?: string(name='RPS'),
      }(name='Performance'),
      precheckStatus?: {
        detail?: [ 
          {
            checkStatus?: string(name='CheckStatus'),
            errorMessage?: string(name='ErrorMessage'),
            itemName?: string(name='ItemName'),
            repairMethod?: string(name='RepairMethod'),
          }
        ](name='Detail'),
        percent?: string(name='Percent'),
        status?: string(name='Status'),
      }(name='PrecheckStatus'),
      sourceEndpoint?: {
        engineName?: string(name='EngineName'),
        IP?: string(name='IP'),
        instanceId?: string(name='InstanceId'),
        instanceType?: string(name='InstanceType'),
        port?: string(name='Port'),
        userName?: string(name='UserName'),
      }(name='SourceEndpoint'),
      status?: string(name='Status'),
      structureInitialization?: string(name='StructureInitialization'),
      structureInitializationStatus?: {
        errorMessage?: string(name='ErrorMessage'),
        percent?: string(name='Percent'),
        progress?: string(name='Progress'),
        status?: string(name='Status'),
      }(name='StructureInitializationStatus'),
      synchronizationDirection?: string(name='SynchronizationDirection'),
      synchronizationJobClass?: string(name='SynchronizationJobClass'),
      synchronizationJobId?: string(name='SynchronizationJobId'),
      synchronizationJobName?: string(name='SynchronizationJobName'),
      synchronizationObjects?: [ 
        {
          newSchemaName?: string(name='NewSchemaName'),
          schemaName?: string(name='SchemaName'),
          tableExcludes?: [ 
            {
              tableName?: string(name='TableName'),
            }
          ](name='TableExcludes'),
          tableIncludes?: [ 
            {
              tableName?: string(name='TableName'),
            }
          ](name='TableIncludes'),
        }
      ](name='SynchronizationObjects'),
    }
  ](name='SynchronizationInstances'),
  totalRecordCount?: long(name='TotalRecordCount'),
}

model DescribeSynchronizationJobsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSynchronizationJobsResponseBody(name='body'),
}

async function describeSynchronizationJobsWithOptions(request: DescribeSynchronizationJobsRequest, runtime: Util.RuntimeOptions): DescribeSynchronizationJobsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.synchronizationJobName)) {
    query['SynchronizationJobName'] = request.synchronizationJobName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSynchronizationJobs',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSynchronizationJobs(request: DescribeSynchronizationJobsRequest): DescribeSynchronizationJobsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSynchronizationJobsWithOptions(request, runtime);
}

model DescribeSynchronizationObjectModifyStatusRequest {
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  taskId?: string(name='TaskId'),
}

model DescribeSynchronizationObjectModifyStatusResponseBody = {
  dataInitializationStatus?: {
    errorMessage?: string(name='ErrorMessage'),
    percent?: string(name='Percent'),
    progress?: string(name='Progress'),
    status?: string(name='Status'),
  }(name='DataInitializationStatus'),
  dataSynchronizationStatus?: {
    delay?: string(name='Delay'),
    errorMessage?: string(name='ErrorMessage'),
    percent?: string(name='Percent'),
    status?: string(name='Status'),
  }(name='DataSynchronizationStatus'),
  errorMessage?: string(name='ErrorMessage'),
  precheckStatus?: {
    detail?: [ 
      {
        checkStatus?: string(name='CheckStatus'),
        errorMessage?: string(name='ErrorMessage'),
        itemName?: string(name='ItemName'),
        repairMethod?: string(name='RepairMethod'),
      }
    ](name='Detail'),
    percent?: string(name='Percent'),
    status?: string(name='Status'),
  }(name='PrecheckStatus'),
  requestId?: string(name='RequestId'),
  status?: string(name='Status'),
  structureInitializationStatus?: {
    errorMessage?: string(name='ErrorMessage'),
    percent?: string(name='Percent'),
    progress?: string(name='Progress'),
    status?: string(name='Status'),
  }(name='StructureInitializationStatus'),
}

model DescribeSynchronizationObjectModifyStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSynchronizationObjectModifyStatusResponseBody(name='body'),
}

async function describeSynchronizationObjectModifyStatusWithOptions(request: DescribeSynchronizationObjectModifyStatusRequest, runtime: Util.RuntimeOptions): DescribeSynchronizationObjectModifyStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSynchronizationObjectModifyStatus',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSynchronizationObjectModifyStatus(request: DescribeSynchronizationObjectModifyStatusRequest): DescribeSynchronizationObjectModifyStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSynchronizationObjectModifyStatusWithOptions(request, runtime);
}

model ModifySynchronizationObjectRequest {
  ownerId?: string(name='OwnerId'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
  synchronizationObjects?: string(name='SynchronizationObjects'),
}

model ModifySynchronizationObjectResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
  taskId?: string(name='TaskId'),
}

model ModifySynchronizationObjectResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifySynchronizationObjectResponseBody(name='body'),
}

async function modifySynchronizationObjectWithOptions(request: ModifySynchronizationObjectRequest, runtime: Util.RuntimeOptions): ModifySynchronizationObjectResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.synchronizationDirection)) {
    query['SynchronizationDirection'] = request.synchronizationDirection;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  if (!Util.isUnset(request.synchronizationObjects)) {
    query['SynchronizationObjects'] = request.synchronizationObjects;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifySynchronizationObject',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifySynchronizationObject(request: ModifySynchronizationObjectRequest): ModifySynchronizationObjectResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySynchronizationObjectWithOptions(request, runtime);
}

model ResetSynchronizationJobRequest {
  ownerId?: string(name='OwnerId'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
}

model ResetSynchronizationJobResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ResetSynchronizationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ResetSynchronizationJobResponseBody(name='body'),
}

async function resetSynchronizationJobWithOptions(request: ResetSynchronizationJobRequest, runtime: Util.RuntimeOptions): ResetSynchronizationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.synchronizationDirection)) {
    query['SynchronizationDirection'] = request.synchronizationDirection;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResetSynchronizationJob',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function resetSynchronizationJob(request: ResetSynchronizationJobRequest): ResetSynchronizationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return resetSynchronizationJobWithOptions(request, runtime);
}

model StartSynchronizationJobRequest {
  ownerId?: string(name='OwnerId'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
}

model StartSynchronizationJobResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model StartSynchronizationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartSynchronizationJobResponseBody(name='body'),
}

async function startSynchronizationJobWithOptions(request: StartSynchronizationJobRequest, runtime: Util.RuntimeOptions): StartSynchronizationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.synchronizationDirection)) {
    query['SynchronizationDirection'] = request.synchronizationDirection;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartSynchronizationJob',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startSynchronizationJob(request: StartSynchronizationJobRequest): StartSynchronizationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return startSynchronizationJobWithOptions(request, runtime);
}

model SuspendSynchronizationJobRequest {
  ownerId?: string(name='OwnerId'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
}

model SuspendSynchronizationJobResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model SuspendSynchronizationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SuspendSynchronizationJobResponseBody(name='body'),
}

async function suspendSynchronizationJobWithOptions(request: SuspendSynchronizationJobRequest, runtime: Util.RuntimeOptions): SuspendSynchronizationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.synchronizationDirection)) {
    query['SynchronizationDirection'] = request.synchronizationDirection;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SuspendSynchronizationJob',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function suspendSynchronizationJob(request: SuspendSynchronizationJobRequest): SuspendSynchronizationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return suspendSynchronizationJobWithOptions(request, runtime);
}

model SwitchSynchronizationEndpointRequest {
  endpoint?: {
    IP?: string(name='IP'),
    instanceId?: string(name='InstanceId'),
    instanceType?: string(name='InstanceType'),
    port?: string(name='Port'),
    type?: string(name='Type'),
  }(name='Endpoint'),
  ownerId?: string(name='OwnerId'),
  synchronizationDirection?: string(name='SynchronizationDirection'),
  synchronizationJobId?: string(name='SynchronizationJobId'),
}

model SwitchSynchronizationEndpointResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
  taskId?: string(name='TaskId'),
}

model SwitchSynchronizationEndpointResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SwitchSynchronizationEndpointResponseBody(name='body'),
}

async function switchSynchronizationEndpointWithOptions(request: SwitchSynchronizationEndpointRequest, runtime: Util.RuntimeOptions): SwitchSynchronizationEndpointResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.synchronizationDirection)) {
    query['SynchronizationDirection'] = request.synchronizationDirection;
  }
  if (!Util.isUnset(request.synchronizationJobId)) {
    query['SynchronizationJobId'] = request.synchronizationJobId;
  }
  if (!Util.isUnset(request.endpoint)) {
    query['Endpoint'] = request.endpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SwitchSynchronizationEndpoint',
    version = '2019-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function switchSynchronizationEndpoint(request: SwitchSynchronizationEndpointRequest): SwitchSynchronizationEndpointResponse {
  var runtime = new Util.RuntimeOptions{};
  return switchSynchronizationEndpointWithOptions(request, runtime);
}

